![]() |
PBHCopyFileSync |
||||
Header: | Files.h | Carbon status: | Supported | |
Duplicates a file and optionally renames it.
OSErr PBHCopyFileSync ( HParmBlkPtr paramBlock );
A pointer to a copyParam variant of the HFS parameter block.
A result code.
The relevant fields of the parameter block are:
On input, a pointer to a completion function.
On output, the result code of the function.
On input, a pointer to a pathname.
On input, a volume specification for the source volume.
On input, a destination volume identifier.
On input, a pointer to the destination pathname (may be NULL).
On input, a pointer to the file’s new name (may be NULL).
On input, the destination directory ID.
On input, the source directory ID.
This an optional call for AppleShare file servers. Your application should examine the information returned by the PBHGetVolParmsSync function to see if the volume supports PBHCopyFileSync.
For AppleShare file servers, the source and destination pathnames must indicate the same file server; however, the parameter block may specify different source and destination volumes on that file server. A useful way to tell if two file server volumes are on the same file server is to call the PBHGetVolParmsSync function for each volume and compare the server addresses returned. The server opens source files with read/deny write enabled and destination files with write/deny read and write enabled.
You specify the source file with the ioVRefNum, ioDirID, and ioNamePtr fields. You specify the destination directory with the ioDstVRefNum, ioNewDirID, and ioNewName fields. If ioNewName is NULL, the destination directory is the directory having ID ioNewDirID on the specified volume; if ioNewName is not NULL, the destination directory is the directory having the partial pathname pointed to by ioNewName in the directory having ID ioNewDirID on the specified volume.
The ioCopyName field may contain a pointer to an optional string to be used in copying the file; if it is not NULL, the file copy is renamed to the name specified in ioCopyName. The string pointed to by ioCopyName must be a filename, not a partial pathname.
This function is especially useful when you want to copy or move files located on a remote volume, because it allows you to forgo transmitting large amounts of data across a network. This function is used internally by the Finder; most applications do not need to use it.
Supported in Carbon. Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.
© 2000 Apple Computer, Inc. — (Last Updated 5/8/2000)